package com.wfcm.utils;

import java.util.UUID;

/**
 * UUID 生成工具类
 * @author lyinlong
 *
 */
public class UUIDGenerator {
	
	
	public UUIDGenerator() {  }  
  
	/**
	 * 获取UUID
	 * @param isExistLine 是否需要含有短横线的UUID
	 * @return
	 */
    public static String getUUID(boolean isExistLine) {  
        UUID uuid = UUID.randomUUID();  
        String str = uuid.toString();  
        return isExistLine ? str : str.substring(0, 8) + str.substring(9, 13) + str.substring(14, 18) + str.substring(19, 23) + str.substring(24); 
    }  
    
    //获得指定数量的UUID  
    public static String[] getUUID(int number) {  
        if (number < 1) {  
            return null;  
        }  
        String[] ss = new String[number];  
        for (int i = 0; i < number; i++) {  
            ss[i] = getUUID(false);  
        }  
        return ss;  
    }  
    
    public static int getRandom() {
        int number = 0;
        while (true) {
            number = (int) (Math.random() * 1000);
            if (number >= 100 && number < 1000) {
                break;
            }
        }
        return number;
    }
    public static void main(String[] args){
    	System.out.println(getRandom());
    }
}
